import zipfile


def extract_file(zip_path, destination_path, file_name):
    archive = zipfile.ZipFile(zip_path)
    archive.extract(file_name, path=destination_path, pwd=bytes('infected','utf-8'))

def extract_malware_files(zip_path, destination_path, malware_type, malware_count, start_line):
    file = open("destination/malware_grouped_result/" + str(malware_type), "r")

    for i in range(malware_count):

        if i < start_line:
            continue

        hash_code = file.readline().strip()
        file_name_in_archive = "VirusShare_" + str(hash_code)
        extract_file(zip_path, destination_path, file_name_in_archive)

    file.close()

extract_malware_files('D:\malwares\VirusShare_00000.zip', 'D:\malwares', "Virus" , 10, 5)